import FileSystem from "./FileSystem";

function ActiveSoftUtil() {
    const fileName = 'system.conf'
    this.saveActiveCode = async function (activeCode) {
        var config = FileSystem.readFileSync(fileName)
        var configObject = {}
        if(config){
            configObject = JSON.parse(config)
        }
        configObject.activeCode = activeCode
        FileSystem.writeFileSync(fileName, JSON.stringify(configObject))
    }
    this.getAvtiveCode = function () {
        var config = FileSystem.readFileSync(fileName)
        if(!config){
            return ''
        }
        var configObject = JSON.parse(config)
        return configObject.activeCode
    }
}

export default new ActiveSoftUtil()
